package uit.edu.vn;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.content.res.Resources;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class FileObjectAdapter extends BaseAdapter {
	private List<FileObject> listsms;
	private LayoutInflater mInflater;
	private Context context;
	private Resources res;
	private ArrayList<Boolean> itemFileChecked = new ArrayList<Boolean>();

	public FileObjectAdapter(Context context,List<FileObject> listsms) {
		// TODO Auto-generated constructor stub
		
		this.context=context;
		this.listsms=listsms;
		mInflater=LayoutInflater.from(context);
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return listsms.size();
	}
	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return listsms.get(position);
	}
	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub	
		final FileObject entry = listsms.get(position);
		 if(convertView==null)
		 {
			 convertView=mInflater.inflate(R.layout.row_file, null);
		 }
		 Log.d("view", "vao view");
		 TextView txt_nameFile = (TextView)convertView.findViewById(R.id.txt_fileName);
		 TextView txt_sizeFile= (TextView)convertView.findViewById(R.id.txt_filePath);
		// ImageView img_iconFile= (ImageView)convertView.findViewById(R.id.img_fileIcon);
		 txt_nameFile.setText(entry.getFileName());
		 txt_sizeFile.setText(entry.getFileSize());
		 
		
		return convertView;
	}
}
